package com.cecsmsserve.controller;


import com.cecsmsserve.entity.ActivityType;
import com.cecsmsserve.service.IActivityTypeService;
import com.cecsmsserve.util.result.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 王郝浠
 * @since 2024-04-17
 */
@CrossOrigin
@RestController
@RequestMapping("/activityType")
public class ActivityTypeController {

    @Autowired
    IActivityTypeService activityTypeService;

    @GetMapping("/selectAll")
    public CommonResult selectAll(){return activityTypeService.selectAll();}

    @GetMapping("/selectByName/{name}")
    public CommonResult selectByName(@PathVariable("name")String name){
        return activityTypeService.selectByName(name);
    }

    @GetMapping("/selectByState1")
    public CommonResult selectByState1(){
        return activityTypeService.selectByState1();
    }

    @PutMapping("/insert")
    public CommonResult insert(@RequestBody ActivityType activityType){
        return activityTypeService.insert(activityType);
    }

    @PostMapping("/update")
    public CommonResult update(@RequestBody ActivityType activityType){
        return activityTypeService.update(activityType);
    }
}
